/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"90B41542-E0D4-4848-AD32-E42DD806B46A"}
 */
function agregar(event) {
	
	var $sql = 'SELECT servicio_id FROM servicios WHERE servicio_id NOT IN (SELECT servicio_id FROM servicios_x_hotel WHERE hotel_id = ?)'
	var $args = [globals.gHotelId]
	var $ds = databaseManager.getDataSetByQuery('hoteleria',$sql,$args,-1)
	
	if ($ds.getMaxRowIndex() == 0)
	{
		globals.DIALOGS.showWarningDialog('Aviso','El hotel cuenta con todos los servicios','OK')
		return
	}
	var $win = application.createWindow('NUEVO_SERVICIO',JSWindow.MODAL_DIALOG)
	$win.title = 'Nuevo Servicio'
	$win.undecorated = true
	forms.servicios_alta.controller.loadRecords($ds)
	forms.servicios_alta.controller.show($win)
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"BDE59102-ED64-4075-910F-93462845E3F5"}
 */
function borrar(event) {
	var $resp = globals.DIALOGS.showQuestionDialog('Confirmación','¿Desea eliminar este servicio?','Si','No')
	if ($resp == 'Si')
	{
		controller.deleteRecord()
	}
}
